Loading...
 

Batch files for starting a ClassiX® application

Batch files for starting a ClassiX® application

ClassiX® requires several correctly initialised environment variables for the start (see also Environment Variables).

Most of the environment variables are set in the start batch file, which is delivered with the software and is named project_START.BAT (e.g. Evaluate_START.bat). This start batch file should contain all sensitive environment settings, e.g. where the database is located. This so-called master information is stored there and should not be changed from case to case.

Additionally there are machine or user specific variables, which are set in the project_init.bat These two batch files are called up by a project.bat and can thus be combined as desired.

project.bat

The calling batch file accesses the other two batch files and thus allows individual adaptation for certain environment variables which are to be overwritten and also access to deviating CXPs.
Thus, individual batch files can be created for different areas and purposes.

call %~dp0\evaluate_init.bat

call %CX_ROOTDIR%\projects\Evaluate_START.bat %CX_ROOTDIR%\projects\evaluate.cxp %CX_ROOTDIR%\system\Evaluate\Evaluate.ext

In the last line, the general project_START.BAT is called, with the .cxp file as parameter. All other parameters are passed directly to the .exe file called in the project_START.BAT. For both the project_START.BAT and the .cxp file, you should make sure that file names are given with complete path descriptions. This should always be done relatively using %CX_ROOTDIR%.

project_init.bat

However, a few environment variables are machine or user specific. These are set in a calling project_init batch file, which must be adjusted accordingly. The minimum environment variables normally required are the following:

  • CX_ROOTDIR: Points to the root directory of the project, e.g. CX_ROOTDIR=c:\classix\Evaluate
  • CX_EDITOR:
    Pfad zum Texteditor und Aufrufparameter, z.B. CX_EDITOR=code.cmd -r -g %%s:%%d:%%d "H:\VSCode\classix.code-workspace"
  • CX_VERSION: The calling file should also define with which DLL version ClassiX® is to be started. For example 4.4 or 4.5, but in the project_START.bat the case should be intercepted that the value of this variable is "invalid", then a version defined as standard should be started.

In addition, the country information must be set correctly, and always to the location of the computer:

  • CX_COUNTRY
  • CX_STATE
  • CX_REGION

If the ClassiX® licences are machine-bound, the licence file must also be specified individually for each computer.

  • CX_LICENSE_FILE

In addition to these mandatory environment variables, specifications from the general batch file can also be overwritten in the local batch file. The following environment variables can be set additionally:

  • CX_BIN
  • CX_CUSTOMER_DATA
  • CX_LISTVIEW_READONLY_TXN
  • OS_AS_SIZE

Here is an example of a project_init batch file that combines all points:

IF NOT DEFINED CX_ROOTDIR SET CX_ROOTDIR=Y:\classix\Evaluate

IF NOT DEFINED SET CX_HELPROOT=
IF NOT DEFINED SET CX_HELPROOT_APPSWH=http://appswarehouse.de
IF NOT DEFINED SET CX_HELPROOT_INSTANTVIEW=http://instantview.org
IF NOT DEFINED SET CX_WIKI_HELP=TRUE

IF NOT DEFINED CX_EDITOR SET CX_EDITOR=code.cmd -r -g %%s+%%d:%%d "H:\VSCode\classix.code-workspace"

IF NOT DEFINED CX_COUNTRY SET CX_COUNTRY=049
IF NOT DEFINED CX_STATE SET CX_STATE=005
IF NOT DEFINED CX_REGION SET CX_REGION=001
IF NOT DEFINED CX_VERSION SET CX_VERSION=4.5

This example sets with the first 6 environment variables the minimum necessary to start ClassiX® in general.

In order that changed environment variables can be entered in the project.bat, the environment variables in the project_init.bat should only be set if they do not yet exist. With 'IF NOT DEFINED ENVIRONMENT VARIABLE' it can be checked whether the environment variable already exists.

project_START.bat

Further environment variables are then set in the general project_START.BAT, partly depending on the variables already set in the local batch file.

Example of a project_START.BAT:

REM CX_ROOTDIR und CX_HELPROOT sollen z.B. in einem aufrufenden BAT-File definiert werden!

REM -
REM OStore-Variablen allg.
REM
-
IF NOT DEFINED OS_SCHEMA_PATH SET OS_SCHEMA_PATH=%CX_BIN%
IF NOT DEFINED OS_AUTH SET OS_AUTH=NONE
IF NOT DEFINED OS_AS_SIZE SET OS_AS_SIZE=0x5000000000
IF DEFINED CX_VERSION (
  IF -%CX_VERSION:~0,1%- -4- (
    IF NOT DEFINED OS_ENABLE_DECACHE_SOFT_POINTERS_AFTER_AS_RELEASE SET OS_ENABLE_DECACHE_SOFT_POINTERS_AFTER_AS_RELEASE=1
  )
)

REM -
REM ClassiX®-Variablen allg.
REM
-
IF NOT DEFINED CX_PROJECT_INITIALS SET CX_PROJECT_INITIALS=EVA
IF NOT DEFINED CX_PROJECT_NAME SET CX_PROJECT_NAME=EVALUATE
IF NOT DEFINED CX_VERSION SET CX_VERSION=4.5
IF NOT DEFINED CX_BIN SET CX_BIN=%CX_ROOTDIR%\%CX_VERSION%
IF NOT DEFINED CX_CUSTOMER_DATA SET CX_CUSTOMER_DATA=%CX_ROOTDIR%\APPSWH\%CX_PROJECT_NAME%\DATA

IF NOT DEFINED CX_BITMAP SET CX_BITMAP=%CX_ROOTDIR%\Bmp\%CX_PROJECT_NAME%;%CX_ROOTDIR%\Bmp
IF NOT DEFINED CX_SYSTEM SET CX_SYSTEM=%CX_ROOTDIR%\System\%CX_PROJECT_NAME%;%CX_ROOTDIR%\System
IF NOT DEFINED CX_CLUSTERING SET CX_CLUSTERING=255

IF NOT DEFINED CX_DATABASE SET CX_DATABASE=%CX_ROOTDIR%\projects\evaluate.cxd
IF NOT DEFINED CX_DATABASE_2 SET CX_DATABASE_2=%CX_ROOTDIR%\projects\evaluate_2.cxd
IF NOT DEFINED CX_DATABASE_3 SET CX_DATABASE_3=%CX_ROOTDIR%\projects\evaluate_3.cxd

IF NOT DEFINED CX_SYSTEM_DB SET CX_SYSTEM_DB=%CX_DATABASE%

IF NOT DEFINED CX_WORD_DOT SET CX_WORD_DOT=%CX_ROOTDIR%\System\classix.dot
IF NOT DEFINED CX_PATH SET CX_PATH=%CX_ROOTDIR%\APPSWH\%CX_PROJECT_NAME%;%CX_ROOTDIR%\APPSWH;%CX_ROOTDIR%\APPSWH\%CX_PROJECT_NAME%\DATA;%CX_ROOTDIR%\APPSWH\DATA
IF NOT DEFINED CX_LISTVIEW_READONLY_TXN SET CX_LISTVIEW_READONLY_TXN=50

IF NOT DEFINED BIRT_RESOURCE_FOLDER SET BIRT_RESOURCE_FOLDER=%CX_ROOTDIR%\BIRT
IF NOT DEFINED CX_REPORTS SET CX_REPORTS=%CX_ROOTDIR%\BIRT\%CX_PROJECT_NAME%;%CX_ROOTDIR%\birt
IF NOT DEFINED CX_REPORTS_OUT SET CX_REPORTS_OUT=%CX_ROOTDIR%\BIRT\%CX_PROJECT_NAME%
IF NOT DEFINED CLASSPATH SET CLASSPATH=%CX_BIN%\%BIRT_HOME%\ReportEngine\lib\*;%CLASSPATH%

REM -
REM Windows-Variablen allg.
REM
-
SET PATH=%CX_BIN%;%CX_BIN%\ACETAO;%CX_BIN%\ELSTER;%PATH%
rem -
rem Arbeitsverzeichnis setzen (wg. OS-Error und temp. Dateien)
rem
-

IF NOT DEFINED ADIR SET ADIR=C:\TEMP
IF DEFINED TEMP SET ADIR=%TEMP%
IF EXIST %ADIR% cd %ADIR%


REM -
REM Start
REM
-
start "ClassiX" "%CX_BIN%"\cx_osuo.exe %1 -iEvaluate.ini %2 %3 %4 %5

If several ClassiX® systems are operated, e.g. a real system and a test system, it has proven to be practicable to anchor the corresponding settings in the general batch file and to control them only via one parameter. The general batch file could then look like this:

REM CX_ROOTDIR und CX_HELPROOT sollen z.B. in einem aufrufenden BAT-File definiert werden!

IF "%2" "ECHT" goto ECHT
IF "%2" == "TEST" goto TEST

:ECHT

IF NOT DEFINED CX_SERVER SET CX_SERVER=\\cxeva\EVA_DB
IF NOT DEFINED CX_DATABASE SET CX_DATABASE=%CX_SERVER%\ClassiX\Evaluate\projects\evaluate.cxd
IF NOT DEFINED OS_SCHEMA_PATH SET OS_SCHEMA_PATH=%CX_SERVER%\ClassiX\Evaluate\projects\edb
goto WEITER

:TEST

IF NOT DEFINED CX_SERVER SET CX_SERVER=\\clxdb0\CX_DB
IF NOT DEFINED CX_DATABASE SET CX_DATABASE=%CX_SERVER%\ClassiX\Evaluate\projects\evaluate_test.cxd
IF NOT DEFINED OS_SCHEMA_PATH SET OS_SCHEMA_PATH=%CX_SERVER%\ClassiX\Evaluate\projects\edb
goto WEITER

:WEITER

REM ... hier entsprechend weiter mit allgemeiner Batch-Datei wie oben.

The call in the local project batch file then controls via a further parameter which of the ClassiX® systems is started:

call %CX_ROOTDIR%\projects\Evaluate_START.bat %CX_ROOTDIR%\projects\evaluate.cxp %CX_ROOTDIR%\system\Evaluate\Evaluate.ext ECHT

In order that changed environment variables can be entered in the project.bat, the environment variables in the project_START.bat should only be set if they do not yet exist. With 'IF NOT DEFINED ENVIRONMENT VARIABLE' it can be checked whether the environment variable already exists.